﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;

namespace TMI85303.UI.Cov
{
    public class TextBoxString2IntCov : IValueConverter
    {
        public object? Convert(object? value, Type targetType, object parameter, CultureInfo culture)
        {
            return value?.ToString() ?? "";
        }

        public object? ConvertBack(object? value, Type targetType, object parameter, CultureInfo culture)
        {
            // 从TextBox转换回绑定源属性
            return int.TryParse(value as string, out var number) ? number : null;
        }
    }
}
